<?php

namespace App\Library\SMS\aliyunsdk;

use App\Modules\Admin\Entities\System\SmsRecordModel;

class AliyunSms
{

    public function sms_send($phone,$code,$type,$time=5){

        $request = SmsClient::apiAliyunSms($phone,$code,$type,$time);
        $log_data =[
            'type'=>$type,
            'phone'=>$phone,
            'content' => json_encode($request['content']),
            'code'=>$code,
            'template'=>$request['template'],
            'ip'=>get_ip(),
            'record_id'=>$request['requestId'],
        ];
        SmsRecordModel::getInstance()->create($log_data);
        return true;
    }
}
